package com.starhub.application.collection.enums;

/**
 * 元数据表业务类型枚举
 * @version: V1.0
 * @author: liuhf
 * @time 2025-06-06
 */
public enum MetaDataCollectionTypeEnums {

    /**
     * 数据表示
     */
    DATABASE_REPRESENTATION(0, "数据表示"),

    /**
     * 向量表示
     */
    VECTOR_REPRESENTATION(1, "向量表示");

    private final Integer code;
    private final String desc;  

    MetaDataCollectionTypeEnums(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据code获取枚举值
     * @param code
     * @return
     */
    public static MetaDataCollectionTypeEnums getByCode(Integer code) {
        for (MetaDataCollectionTypeEnums type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

    /**
     * 根据code获取描述
     * @param code
     * @return
     */
    public static String getDescByCode(Integer code) {
        MetaDataCollectionTypeEnums type = getByCode(code);
        return type == null ? null : type.getDesc();
    }

    /**
     * 判断code是否有效
     * @param code
     * @return
     */
    public static boolean isValid(Integer code) {
        return getByCode(code) != null;
    }
    
}               
